//
//  WhiteNaviBar.m
//  WOFishingBoat
//
//  Created by 郑逸凯 on 2019/1/3.
//  Copyright © 2019年 郑逸凯. All rights reserved.
//

#import "WhiteNaviBar.h"

#define LEFT_MARGIN 13

@interface WhiteNaviBar ()

@property (nonatomic,strong)UILabel *titleLabel;

@end

@implementation WhiteNaviBar
#pragma mark - Life Cycle
+ (instancetype)newBar {
    return [[self alloc] init];
}

- (instancetype)init {
    if (self = [super init]) {
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH, Height_TopBar);
        CGFloat titleHeight = 44;
        self.titleLabel.frame = CGRectMake(LEFT_MARGIN, self.frame.size.height - titleHeight, self.frame.size.width- LEFT_MARGIN, titleHeight);
        UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(20, self.frame.size.height - 1, self.frame.size.width - 20 * 2, 1)];
        lineView.backgroundColor = RGB16(0xE6E6E6);
        [self addSubview:lineView];
        [self addSubview:self.titleLabel];
    }
    return self;
}


#pragma mark - Public Methods

- (void)setTitle:(NSString *)title {
    if (title && self.titleLabel) {
        self.titleLabel.text = title;
    }
}

#pragma mark - Responder Actions
#pragma mark - Delegates
#pragma mark - Private Methods
#pragma mark - Setters and Getters

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.font = [UIFont boldSystemFontOfSize:25];
        _titleLabel.textColor = RGB16(0x3333333);
    }
    return _titleLabel;
}

#pragma mark - Helper

@end
